package com.zzptc.syl.a1015;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class RegActivity extends AppCompatActivity {
    Button btreg;
    EditText etname2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.reg);
        init();
        event();
    }

    private void event() {
        btreg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //Toast.makeText(RegActivity.this, ""+etname2.getText().toString().trim(), Toast.LENGTH_SHORT).show();
                //获取用户名
                String name = etname2.getText().toString().trim();

                Intent intent=new Intent();
                intent.putExtra("name",name);
                //回传
                setResult(2,intent);
                finish();
            }
        });
    }

    private void init() {
        btreg=findViewById(R.id.bt_reg);
        etname2=findViewById(R.id.et_name2);

    }
}
